/*
 * Copyright (c) 2011 Team A CS2340. All rights reserved.
 */

package edu.gatech.teama.doctorsoffice.model;

import java.io.IOException;
import java.io.Serializable;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;


/**
 * The Class Doctor extends User.  Creates a new doctor usertype.
 * 
 * @author TeamA
 * @version 1.0
 */
public class Doctor extends User implements Serializable{
    
    /** The my logger. */
    private static final Logger MYLOGGER = 
    	Logger.getLogger("edu.gatech.teama.doctorsoffice.model.Doctor");
    
    static {
        FileHandler fh = null;
        try {
            fh = new FileHandler("application.log");
        } catch (SecurityException e) {
            MYLOGGER.log(Level.SEVERE, 
            		"Security Exception creating the logger file handler");
            e.printStackTrace();
        } catch (IOException e) {
            MYLOGGER.log(Level.SEVERE, "IO Exception creating the logger file handler");
            e.printStackTrace();
        }

        MYLOGGER.addHandler(fh);
        MYLOGGER.setLevel(Level.ALL);
    }

    /**
     * Instantiates a new doctor with specified username.
     *
     * @param username the username
     */
    public Doctor(String username){
    	super(username);
        MYLOGGER.log(Level.INFO, "Doctor: no details");
        
    }

    /**
     * Instantiates a new Doctor.
     *
     * @param username the username
     * @param firstName the first name
     * @param lastName the last name
     * @param phoneNumber the phone number
     * @param address the address
     * @param emailAddress the email address
     */
    public Doctor(String username, String firstName, String lastName, String phoneNumber,
    		Address address, String emailAddress){
        super(username, firstName, lastName, phoneNumber, address, emailAddress);
        
        MYLOGGER.log(Level.INFO, "New Doctor: " + username + ", " + firstName
        		+ " " + lastName + ", " + phoneNumber + ", "
        		+ address + ", " + emailAddress);     
    }
    
    /**
     * toString() method returns the doctor's first and last name
     * 
     * @return The doctor's first and last name
     */
	@Override
	public String toString() {
		return "Doctor: " + getFirstName() + " "
				+ getLastName();
	}
    
    
}



